<?php
/**
 * User: roman
 * Date: 13.07.11
 * Time: 14:46
 */

namespace Managers;

class Translates extends BaseManager {

    protected $_entity = '\Catalog\Translates';


    public function qb() {

        return $this->_em->getRepository($this->_entity)->createQueryBuilder('c');

    }

    public function page($translate) {

        $res = $this->_em->createQueryBuilder()
                ->select('p', 'trans')
                ->from($this->_entity, 'trans')
                ->join('trans.page', 'p')
                ->where('trans.id = :id')
                ->setParameter('id', $translate)
                ->getQuery()
                ->getArrayResult();

        return $res[0]['id'];

    }


}
